|
usbcpower3 2.2.0
|
API for configuring and manipulating USB-C Power 3 Click driver. More...
Topics | |
| USB-C Power 3 Registers List | |
| List of registers of USB-C Power 3 Click driver. | |
| USB-C Power 3 Registers Settings | |
| Settings for registers of USB-C Power 3 Click driver. | |
| USB-C Power 3 MikroBUS Map | |
| MikroBUS pin mapping of USB-C Power 3 Click driver. | |
Functions | |
| void | usbcpower3_cfg_setup (usbcpower3_cfg_t *cfg) |
| USB-C Power 3 configuration object setup function. | |
| err_t | usbcpower3_init (usbcpower3_t *ctx, usbcpower3_cfg_t *cfg) |
| USB-C Power 3 initialization function. | |
| err_t | usbcpower3_ptn_write_reg_byte (usbcpower3_t *ctx, uint8_t reg, uint8_t data_in) |
| USB-C Power 3 PTN write register byte function. | |
| err_t | usbcpower3_ptn_read_reg_byte (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_out) |
| USB-C Power 3 PTN read register byte function. | |
| err_t | usbcpower3_ptn_write_reg_word (usbcpower3_t *ctx, uint8_t reg, uint16_t data_in) |
| USB-C Power 3 PTN write register word function. | |
| err_t | usbcpower3_ptn_read_reg_word (usbcpower3_t *ctx, uint8_t reg, uint16_t *data_out) |
| USB-C Power 3 PTN read register word function. | |
| err_t | usbcpower3_ptn_write_reg_block (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| USB-C Power 3 PTN write register block function. | |
| err_t | usbcpower3_ptn_read_reg_block (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| USB-C Power 3 PTN read register block function. | |
| err_t | usbcpower3_act_write_reg (usbcpower3_t *ctx, uint8_t reg, uint8_t data_in) |
| USB-C Power 3 ACT write register function. | |
| err_t | usbcpower3_act_read_reg (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_out) |
| USB-C Power 3 ACT read register function. | |
| err_t | usbcpower3_ptn_read_info (usbcpower3_t *ctx) |
| USB-C Power 3 PTN read device information function. | |
| void | usbcpower3_enable_device (usbcpower3_t *ctx) |
| USB-C Power 3 device enable function. | |
| void | usbcpower3_disable_device (usbcpower3_t *ctx) |
| USB-C Power 3 device disable function. | |
| void | usbcpower3_restart_device (usbcpower3_t *ctx) |
| USB-C Power 3 device restart function. | |
| err_t | usbcpower3_wait_tcpc_init (usbcpower3_t *ctx) |
| USB-C Power 3 wait TCPC init function. | |
| void | usbcpower3_set_high_current (usbcpower3_t *ctx) |
| USB-C Power 3 set high current function. | |
| void | usbcpower3_set_low_current (usbcpower3_t *ctx) |
| USB-C Power 3 set low current function. | |
| uint8_t | usbcpower3_get_int_pin (usbcpower3_t *ctx) |
| USB-C Power 3 get interrupt pin function. | |
| uint8_t | usbcpower3_get_fen_pin (usbcpower3_t *ctx) |
| USB-C Power 3 get FEN pin function. | |
API for configuring and manipulating USB-C Power 3 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| err_t usbcpower3_act_read_reg | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
USB-C Power 3 ACT read register function.
This function reads one byte from the selected ACT buck-boost converter register over I2C.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Pointer to the memory location where the read data will be stored. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_act_write_reg | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
USB-C Power 3 ACT write register function.
This function writes one byte to the selected ACT buck-boost converter register over I2C.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data byte to write. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void usbcpower3_cfg_setup | ( | usbcpower3_cfg_t * | cfg | ) |
USB-C Power 3 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See usbcpower3_cfg_t object definition for detailed explanation. |
| void usbcpower3_disable_device | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 device disable function.
This function disables the device by clearing the enable pin.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| void usbcpower3_enable_device | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 device enable function.
This function enables the device by setting the enable pin.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| uint8_t usbcpower3_get_fen_pin | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 get FEN pin function.
This function reads the FEN pin state.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| uint8_t usbcpower3_get_int_pin | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 get interrupt pin function.
This function reads the interrupt pin state.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| err_t usbcpower3_init | ( | usbcpower3_t * | ctx, |
| usbcpower3_cfg_t * | cfg ) |
USB-C Power 3 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See usbcpower3_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_ptn_read_info | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 PTN read device information function.
This function reads device identification and revision information from PTN USB PD registers.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_ptn_read_reg_block | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
USB-C Power 3 PTN read register block function.
This function reads multiple bytes from the selected PTN USB PD register over I2C.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Pointer to the memory location where the read data will be stored. |
| [in] | len | : Number of bytes to read. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_ptn_read_reg_byte | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
USB-C Power 3 PTN read register byte function.
This function reads one byte from the selected PTN USB PD register using the block read function.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Pointer to the memory location where the read data will be stored. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_ptn_read_reg_word | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint16_t * | data_out ) |
USB-C Power 3 PTN read register word function.
This function reads a 16-bit word from the selected PTN USB PD register in little-endian format.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Pointer to the memory location where the read data word will be stored. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. NULL and the read is successful. | err_t usbcpower3_ptn_write_reg_block | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
USB-C Power 3 PTN write register block function.
This function writes multiple bytes to the selected PTN USB PD register over I2C.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Pointer to the data buffer to write. |
| [in] | len | : Number of bytes to write. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_ptn_write_reg_byte | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
USB-C Power 3 PTN write register byte function.
This function writes one byte to the selected PTN USB PD register using the block write function.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data byte to write. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t usbcpower3_ptn_write_reg_word | ( | usbcpower3_t * | ctx, |
| uint8_t | reg, | ||
| uint16_t | data_in ) |
USB-C Power 3 PTN write register word function.
This function writes a 16-bit word to the selected PTN USB PD register in little-endian format.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : 16-bit data word to write. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void usbcpower3_restart_device | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 device restart function.
This function restarts the device by disabling and re-enabling it.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| void usbcpower3_set_high_current | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 set high current function.
This function sets the current limit pin to a high logic level.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| void usbcpower3_set_low_current | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 set low current function.
This function sets the current limit pin to a low logic level.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
| err_t usbcpower3_wait_tcpc_init | ( | usbcpower3_t * | ctx | ) |
USB-C Power 3 wait TCPC init function.
This function waits for TCPC initialization to complete.
| [in] | ctx | : Click context object. See usbcpower3_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.